Hệ thống quản lý thanh toán POS nhà hàng
1 Imports System.Data.OleDb
2 Public Class frmNotes1
3 Declare Function Wow64DisableWow64FsRedirection Lib "kernel32" (ByRef oldvalue As Long) As Boolean
4 Declare Function Wow64EnableWow64FsRedirection Lib "kernel32" (ByRef oldvalue As Long) As Boolean
5
6 Private Sub btnClose_Click(sender As System.Object, e As System.EventArgs) Handles btnClose.Click
7 Me.Close()
8 End Sub
9 Public Sub Getdata()
10 Try
11 con = New OleDbConnection(cs)
12 con.Open()
13 cmd = New OleDbCommand("SELECT RTRIM(Notes) from NotesMaster order by Notes", con)
14 rdr = cmd.ExecuteReader(CommandBehavior.CloseConnection)
15 dgw.Rows.Clear()
16 While (rdr.Read() = True)
17 dgw.Rows.Add(rdr(0))
18 End While
19 con.Close()
20 Catch ex As Exception
21 MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
22 End Try
23 End Sub
24 Private Sub btnGetData_Click(sender As System.Object, e As System.EventArgs) Handles btnOkay.Click
25 Me.Hide()
26 frmBillling.Show()
27 frmBillling.txtNotes.Text = txtNotes.Text
28 End Sub
29 Sub Reset()
30 txtNotes.Text = ""
31 End Sub
32 Private Sub btnKeyboard_Click(sender As System.Object, e As System.EventArgs) Handles btnKeyboard.Click
33 Process.Start("osk.exe")
34 End Sub
35
36 Private Sub dgw_MouseClick(sender As System.Object, e As System.Windows.Forms.MouseEventArgs) Handles dgw.MouseClick
37 Try
38 If dgw.Rows.Count > 0 Then
39 Dim dr As DataGridViewRow = dgw.SelectedRows(0)
40 txtNotes.Text += dr.Cells(0).Value.ToString() & vbCrLf
41 End If
42 Catch ex As Exception
43 MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
44 End Try
45 End Sub
46
47 Private Sub dgw_RowPostPaint(sender As Object, e As System.Windows.Forms.DataGridViewRowPostPaintEventArgs) Handles dgw.RowPostPaint
48 Dim strRowNumber As String = (e.RowIndex + 1).ToString()
49 Dim size As SizeF = e.Graphics.MeasureString(strRowNumber, Me.Font)
50 If dgw.RowHeadersWidth < Convert.ToInt32((size.Width + 20)) Then
51 dgw.RowHeadersWidth = Convert.ToInt32((size.Width + 20))
52 End If
53 Dim b As Brush = SystemBrushes.ControlText
54 e.Graphics.DrawString(strRowNumber, Me.Font, b, e.RowBounds.Location.X + 15, e.RowBounds.Location.Y + ((e.RowBounds.Height - size.Height) / 2))
55
56 End Sub
57
58 Private Sub frmNotes_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
59 Getdata()
60 End Sub
61
62 Private Sub btnClear_Click(sender As System.Object, e As System.EventArgs) Handles btnClear.Click
63 txtNotes.Text = ""
64 End Sub
65 End Class